import React from 'react'
import PropTypes from 'prop-types'
import {
  View,
  StyleSheet,
  Text
} from 'react-native'
import { WIDTH, ScaleS, IS_IPHONEX, ONE_PIXEL } from 'src/utils/ScreenUtil'
import CustomImage from '../image/CustomImage'
import CustomButton from 'src/components/button/CustomButton'

export default class BasicChooseModal extends React.Component {
  static defaultProps = {
  }

  static propTypes = {
    topText: PropTypes.string,
    topFunc: PropTypes.func,
    middleText: PropTypes.string,
    middleFunc: PropTypes.func,
    bottomText: PropTypes.string,
    bottomFunc: PropTypes.string
  }

  render () {
    const { topText, topFunc, middleText, middleFunc, bottomText, bottomFunc } = this.props
    return (
      <View style={styles.container}>
        <View style={styles.topContainer}>
          <CustomButton style={[styles.item, styles.itemLine]} onPress={topFunc}>
            <Text style={styles.itemText}>{topText}</Text>
          </CustomButton>
          <CustomButton style={styles.item} onPress={middleFunc}>
            <Text style={styles.itemText}>{middleText}</Text>
          </CustomButton>
        </View>
        <CustomButton style={[styles.item, styles.itemCancel]} onPress={bottomFunc}>
          <Text style={styles.itemText}>{bottomText}</Text>
        </CustomButton>
      </View>
    )
  }
}

const styles = StyleSheet.create({
  container: {
    width: WIDTH,
    height: ScaleS(IS_IPHONEX ? 196 : 176),
    backgroundColor: '#F2F2F2',
    borderTopLeftRadius: ScaleS(10),
    borderTopRightRadius: ScaleS(10),
    flexDirection: 'column',
    justifyContent: 'space-between',
    alignItems: 'center'
  },
  topContainer: {
    width: WIDTH,
    flexDirection: 'column',
    justifyContent: 'space-between',
    alignItems: 'center',
    paddingHorizontal: ScaleS(20)
  },
  item: {
    width: '100%',
    height: ScaleS(60),
    justifyContent: 'center',
    alignItems: 'center'
  },
  itemLine: {
    borderBottomColor: 'rgba(151, 151, 151, 0.2)',
    borderBottomWidth: ONE_PIXEL,
    borderStyle: 'solid'
  },
  itemCancel: {
    height: ScaleS(IS_IPHONEX ? 80 : 60),
    backgroundColor: '#fff',
    paddingBottom: ScaleS(IS_IPHONEX ? 20 : 0)
  },
  itemText: {
    fontSize: ScaleS(16),
    color: '#000000'
  }
})
